<?php

namespace Modules\Admin\Http\Controllers;

use Houdunwang\Module\Facade\HdModuleConfig;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
use Illuminate\Routing\Controller;
use Modules\Admin\Service\TemplateService;

class TemplateController extends Controller
{
    /**
     * Display a listing of the resource.
     * @return Response
     */
    public function index(TemplateService $templateService)
    {
    	//获取所有模板
		$tps=$templateService->getTemplates ();
        return view('admin::template.index',compact('tps'));
    }

    public function setDefaultTemplate($name){
		\HDModule::saveConfig(['template'=>$name],'config');
		session()->flash('success','设置成功！');
		return redirect ()->back();
	}
}
